import React, {FC} from "react";
import { useNavigate} from 'react-router-dom'
import {Button,Typography} from 'antd'
const {Title,Paragraph} = Typography
import {MANAGE_PATHNAME} from '../router'
import styles from './Home.module.scss'
// import axios from "axios";
// // import '../_mock/index.ts'
const Home:FC=()=>{
    const nav=useNavigate()
    // useEffect(()=>{
    //     // fetch('/api/test')
    //     //     .then(res => res.json())
    //     //     .then(data => console.log('fetch data',data))
    //     //mock.js只能劫持XMLHttpRequest,不能劫持fetch
    //     //axios内部使用的是XMLHttpRequest API
    //     axios.get('/api/test').then(res => console.log('axios',res.data))
    // },[])
    // const nav = useNavigate()//useNavigate() 实现了编程式路由跳转
    // function clickHandler(){
    //     // nav('/login?b=20')
    //     nav({
    //         pathname:'/login',
    //         search:'b=21'
    //     })
    // }
    return(
        <div className={styles.container}>
            <div className={styles.info}>
                <Title>问卷调查 | 在线投票</Title>
                <Paragraph>已累计创建100份</Paragraph>
            </div>
            <Button type="primary" onClick={()=>nav(MANAGE_PATHNAME)}>开始使用</Button>
        </div>
    )
}
export default Home